package com.gitee.ywj1352.stream.event;

import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class GUIEvent {

    public static void main(String[] args) {

        JFrame frame = new JFrame("简单GUI -java 事件");

        //java 8 之间接口没有 default 方法之前 当出现多个监听方法时,需要Adapter抽象类
        frame.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                System.out.printf("[%s]事件: %s\n"+ Thread.currentThread().getName(),e);
            }
        });

        frame.setBounds(200,200,200,200);

        frame.setVisible(true);


    }
}
